package com.haiertvbic.tvwa.start;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;

import com.haiertvbic.tvwa.FavoriteChannelActivity;
/**
 * 开机后三分钟启动代码
 * @author sun
 *
 */
public class BootReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Toast.makeText(context, intent.getAction(), 10000).show();
		if (intent.getAction().equals( "android.intent.action.BOOT_COMPLETED")) {
			new Thread(){
				@Override
				public void run() {
					super.run();
					try {
						sleep(3*60*1000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
				
			}.start();
			Toast.makeText(context, intent.getAction(), 10000).show();
			System.out.println("guagnbo ");
			Intent bootIntent = new Intent(context, FavoriteChannelActivity.class);
			bootIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(bootIntent);
		}

	}

}
